/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package kz.epam.homedevices.computing;

import kz.epam.homedevices.ElectricalDevice;

/**
 *
 * @author Knoppix
 */
public class ComputingDevice extends ElectricalDevice implements Comparable{

    private int cpuSpeed;
    private ComputingType type;

    public ComputingDevice() {
    }

    public ComputingDevice(ComputingType type, String maker, Double cardinality, boolean powerOn, int cpuSpeed) {
        super(maker, cardinality, powerOn);
        this.cpuSpeed = cpuSpeed;
        this.type = type;
    }

    public int getCpuSpeed() {
        return cpuSpeed;
    }

    public void setCpuSpeed(int cpuSpeed) {
        this.cpuSpeed = cpuSpeed;
    }

    
    public ComputingType getType() {
        return type;
    }

    public void setType(ComputingType type) {
        this.type = type;
    }

    @Override
    public String toString() {
        return "\n"+this.type.toString()+" {"
                + super.toString()
                + ", CPU Speed: " + this.cpuSpeed + "MHz}";
    }
    
   @Override
    public int compareTo(Object obj) {
        ElectricalDevice device = (ElectricalDevice) obj;
        if (this.getCardinality() < device.getCardinality()) {
            return -1;
        } else if (this.getCardinality() > device.getCardinality()) {
            return 1;
        } else {
            return 0;
        }
    }
}
